package v1

import (
	"github.com/gin-gonic/gin"
	"wrblog-api-go/app/api/v1/api_sys"
	"wrblog-api-go/app/common/intercept"
	"wrblog-api-go/app/model/model_sys"
	"wrblog-api-go/pkg/defense"
	"wrblog-api-go/pkg/request"
)

func WrFileApi(apiV1 *gin.RouterGroup) {
	//获取列表
	fileApi := apiV1.Group("/file")
	{
		fileApi.POST("/upload", defense.UploadIpLock(100), api_sys.ApiUpload)
		fileApi.GET("/list", request.BindAllStruct[model_sys.SelectSysFile](), api_sys.ApiFileList)
		fileApi.GET("/listIdAll", request.BindAllStruct[model_sys.SelectSysFile](), api_sys.ApiFileIdAll)
		fileApi.GET("/preview/:fileId", api_sys.ApiPreviewFile)
		fileApi.GET("/info/:fileId", api_sys.ApiInfoFile)
		fileApi.PUT("/edit", request.BindAllStruct[model_sys.SysFilePo](), api_sys.ApiFileEdit)
		fileApi.DELETE("/removes", intercept.IsPermission("sys:file:remove"), api_sys.ApiFileRemoves)
	}
}
